package com.boot.consumer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 
 * @author threestrong
 * @desc 项目启动后执行RocketMQ消费代码
 *
 */
@Component
public class ApplicationRunnerImpl implements ApplicationRunner {
	private Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	private RocketMessageMultiConsumer service;

	@Override
	public void run(ApplicationArguments args) throws Exception {
		logger.info("开启RocketMQ消费代码......");
		service.startConsumers();
	}
}